<?php

/**
 * BugReport form base class.
 *
 * @package    form
 * @subpackage bug_report
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseBugReportForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'name'           => new sfWidgetFormInput(),
      'owner_id'       => new sfWidgetFormDoctrineSelect(array('model' => 'User', 'add_empty' => true)),
      'conditions'     => new sfWidgetFormTextarea(),
      'fields'         => new sfWidgetFormTextarea(),
      'group_by'       => new sfWidgetFormInput(),
      'sort_by'        => new sfWidgetFormInput(),
      'sort_direction' => new sfWidgetFormChoice(array('choices' => array('ASC' => 'ASC', 'DESC' => 'DESC'))),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorDoctrineChoice(array('model' => 'BugReport', 'column' => 'id', 'required' => false)),
      'name'           => new sfValidatorString(array('max_length' => 255)),
      'owner_id'       => new sfValidatorDoctrineChoice(array('model' => 'User', 'required' => false)),
      'conditions'     => new sfValidatorString(array('max_length' => 500, 'required' => false)),
      'fields'         => new sfValidatorString(array('max_length' => 500)),
      'group_by'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'sort_by'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'sort_direction' => new sfValidatorChoice(array('choices' => array('ASC' => 'ASC', 'DESC' => 'DESC'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bug_report[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'BugReport';
  }

}